package com.example.hcd.adapt;

import java.util.ArrayList;

import com.example.hcd.R;
import com.example.hcd.datamanage.UserInfoData;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

public class SignAdapt extends BaseAdapter{

	private ArrayList<UserInfoData> myItemList = new ArrayList<UserInfoData>();
	private Context context;
	private LayoutInflater mInflate;
	private boolean isLookDeatail=false;
	public SignAdapt(Context context) {
		// TODO Auto-generated constructor stub
		this.context = context;
		mInflate = LayoutInflater.from(context);
	}
	
	public void setisLookDetail(boolean islook)
	{
		isLookDeatail = islook;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return myItemList.size();
	}

	@Override
	public UserInfoData getItem(int position) {
		// TODO Auto-generated method stub
		return myItemList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
			convertView = mInflate.inflate(R.layout.my_reimburse_item, null);
            
        }
		UserInfoData date = getItem(position);
		TextView text;
		LinearLayout view = (LinearLayout)convertView.findViewById(R.id.line111);
		
		text = (TextView) convertView.findViewById(R.id.name_dep);
		text.setText(date.name);
		

		text = (TextView) convertView.findViewById(R.id.title);
		text.setText("迟到次数      "+date.lateNum);

		text = (TextView) convertView.findViewById(R.id.project_name);
		text.setText("早退次数      "+date.earlyNum);

		text = (TextView) convertView.findViewById(R.id.amount_money);
		text.setText(date.department);

		text = (TextView) convertView.findViewById(R.id.create_time);
		text.setText("加班时长      "+date.overWorkHours);
		
		return convertView;     
	}

	public void setList(ArrayList<UserInfoData> list) {
        if (myItemList != null) {
        	myItemList.clear();
        	myItemList.addAll(list);
        } else {
        	myItemList = list;
        }
        notifyDataSetChanged();
    }
	
	public void addList(ArrayList<UserInfoData> lists)
	{
		myItemList.addAll(lists);
		
	}
}
